/**
 * 
 */
package com.gametime.setup;

import com.gametime.model.Position;
import com.gametime.util.ComUtils;

/**
 * @author dave
 *
 */
public class PositionGenerator {

	private static PositionGenerator instance = null;
	
	
	
	private int[] smalls ={1, 2, 3};
	private int[] mids ={4, 5, 6};
	private int[] bigs ={7, 8, 9};
	
	private PositionGenerator()
	{
		
	}
	public static PositionGenerator getInstance()
	{
		if(instance == null)
			instance = new PositionGenerator();
		return instance;
	}
	
	public Position getRandomSmall()
	{
		// random number 1, 2, 3
		// get form smalls
	    return getMappedPostion(ComUtils.getRandomInt(1, 3));
	}
	
	public Position getRandomMid()
	{
		// random number 1, 2, 3
		// get form smalls
		return getMappedPostion(ComUtils.getRandomInt(4, 6));
	}
	
	public Position getRandomBig()
	{
		return getMappedPostion(ComUtils.getRandomInt(7, 9));
	}
	
	public Position getRandom()
	{
		return getMappedPostion(ComUtils.getRandomInt(1, 9));
	}
	
	public Position getMappedPostion(int pos)
	{
		// random number 1, 2, 3
		//// get form smalls
		
		switch(pos)
		{
		case 1: 
		{
			return getPoint();
		}
		case 2: 
		{
			return getComboGuard();
		}
		case 3: 
		{
			return getBigGuard();
		}
		case 4: 
		{
			return getWing();
		}
		case 5: 
		{
			return getSmallForward();
		}
		case 6: 
		{
			return getForward();
		}
		case 7: 
		{
			return getPowerForward();
		}
		case 8: 
		{
			return getCenterForward();
		}
		case 9: 
		{
			return getCenter();
		}
		default:
			return null;
		}
		
		
	}
	
	private Position getPoint() {
		// TODO Auto-generated method stub
		Position pos = Position.createPosition(1, "Point Guard", "PG");
		return pos;
	}
	
	private Position getComboGuard() {
		// TODO Auto-generated method stub
		Position pos = Position.createPosition(2, "Combo Guard", "CG");
		return pos;
	}
	
	private Position getBigGuard() {
		// TODO Auto-generated method stub
		Position pos = Position.createPosition(3, "Big Guard", "2G");
		return pos;
	}
	
	private Position getWing() {
		// TODO Auto-generated method stub
		Position pos = Position.createPosition(4, "Wing", "W");
		return pos;
	}
	
	private Position getSmallForward() {
		// TODO Auto-generated method stub
		Position pos = Position.createPosition(5, "Small Forward", "SF");
		return pos;
	}
	
	private Position getForward() {
		// TODO Auto-generated method stub
		Position pos = Position.createPosition(6, "Forward", "F");
		return pos;
	}
	
	private static Position getPowerForward() {
		// TODO Auto-generated method stub
		Position pos = Position.createPosition(7, "Power Forward", "PF");
		return pos;
	
	}
	
	private static Position getCenterForward() {
		// TODO Auto-generated method stub
		Position pos = Position.createPosition(8, "Center Forward", "CF");
		return pos;
	}
	
	private static Position getCenter() {
		// TODO Auto-generated method stub
		Position pos = Position.createPosition(9, "Center", "C");
		return pos;
	}
}
